package language.advanced.functional;

class X {
    String f() { return "X::f()"; }
}

interface MakeString {
    String make();
}

interface TransformX {
    String transform(X x);
}

public class UnboundMethodReference {
    public static void main(String[] args) {
//         MakeString ms = X::f;
        X x = new X();

        TransformX sp = X::f; // 类名::方法
        MakeString a = x::f;  //对象名::方法

        System.out.println(sp.transform(x)); // [2]
        System.out.println(x.f()); // 同等效果
    }
}